<?php

namespace App\Admin\Extensions\Form;

use Dcat\Admin\Form\Field;

class CKEditor extends Field
{
    protected $view = 'admin.ckeditor';

    public function __construct($column, $arguments = [])
    {
        parent::__construct($column, $arguments);
        $route = 'dcat.admin.dcat-api.tinymce.upload';
        if (auth('shop')->check()){
            $route = 'dcat.shop.dcat-api.tinymce.upload';
        }elseif (auth('agent')->check()){
            $route = 'dcat.agent.dcat-api.tinymce.upload';
        }
        $this->variables['uploadImageUrl'] = route($route)."?_token=".csrf_token()."&dir=ckeditor%2Fimages";
        $this->variables['uploadFilesUrl'] = route($route)."?_token=".csrf_token()."&dir=ckeditor%2Ffiles";
    }

}
